package qiti;

import java.util.ArrayList;

public class demo10 {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();

        list.add(new Student(1,"张三"));
        list.add(new Student(2,"李四"));
        list.add(new Student(3,"王五"));

        System.out.println(list);

        for (int i=0; i<list.size();i++){
            Student student=list.get(i);

            if (student.getName().equals("张三")){
                student.setName("张三丰");

            }
            if (student.getName().equals("王五")){
                list.remove(student);
            }
        }
        System.out.println(list);

    }

}
